From 841e509c491f7bfc96361a7088e1750aee167f05 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sat, 13 Apr 2024 02:35:18 -0700
Subject: feat(user): biography option

---
 src/routes/user/[user]/+page.svelte | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

(limited to 'src/routes/user/[user]/+page.svelte')

diff --git a/src/routes/user/[user]/+page.svelte b/src/routes/user/[user]/+page.svelte
index 7cffd647..71d03e37 100644
--- a/src/routes/user/[user]/+page.svelte
+++ b/src/routes/user/[user]/+page.svelte
@@ -63,6 +63,9 @@
 	const getBadgeWallCSS = () =>
 		(document.getElementById('badgeWallCSS') as HTMLTextAreaElement).value;
 
+	const getBiography = () =>
+		(document.getElementById('biography') as HTMLTextAreaElement).value.slice(0, 3000);
+
 	// 8.5827814569536423841e0
 </script>
 
@@ -211,7 +214,33 @@
 
 			<p />
 
+			Biography
+
+			<button
+				on:click={() => {
+					if (userData)
+						fetch(root(`/api/preferences?id=${userData.id}&biography`), {
+							method: 'PUT',
+							body: getBiography()
+						}).then(() =>
+							fetch(root(`/api/preferences?id=${userData?.id}`))
+								.then((rawPreferences) => rawPreferences.json())
+								.then((JSONpreferences) => (preferences = JSONpreferences))
+						);
+				}}>Save</button
+			>
+			<textarea
+				value={preferences.biography}
+				rows="5"
+				cols="100"
+				id="biography"
+				placeholder="Markdown supported!"
+			/>
+
+			<p />
+
 			Badge Wall Custom CSS
+
 			<button
 				on:click={() => {
 					if (userData)
-- 
cgit v1.2.3

